package com.hnkywl.sts.entity.zjgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.htgl.Cght;
import com.hnkywl.sts.entity.organ.Ejzh;
import com.hnkywl.sts.entity.organ.Gsjg;
import com.hnkywl.sts.entity.organ.Khh;
import com.hnkywl.sts.entity.organ.Qyjg;
import com.hnkywl.sts.entity.sfgl.Sfk;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 说明：保证金
 * 包:        com.hnkywl.sts.entity.zjgl
 * 类描述:    信用证
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@Table(name = "T_BIZ_BZJ")
@Where(clause = "deleted!='1'")
public class Bzj extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqBzj", allocationSize = 1, sequenceName = "SEQ_BIZ_BZJ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqBzj")
    private Long id;

    /**
     * 公司名称
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "NBGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg nbgs;

    /**
     * 采购合同
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "HT_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Cght cght;

    /**
     * 实收金额
     */
    private Double je;

    /**
     * 余额
     */
    private Double ye;

    /**
     * 理论金额
     */
    private Double llje;

    /**
     * 客户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "KH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg kh;

    /**
     * 二级账户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "EJZH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ejzh ejzh;

    /**
     * 收款
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk sk;

    /**
     * 付款
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "FK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk fk;


    /**
     * 状态  0 未确认  1 已确认
     *
     * @return
     */
    private Integer status = 0;

    //开具保证金
    @ManyToOne
    @JoinColumn(name = "BZJLX_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz bzjlx;

    //保证金比例
    private Double bzjbl;

    //承兑开始时间
    private Date startDate;

    //承兑结束时间
    private Date endDate;

    //客户付款时间
    private Date khfksj;

    //免息天数
    private Integer mxts;

    //贴息率
    private Double txl;

    //贴息
    private Double tx;

    // 计算天数
    private Long jsts;

    //是否补充保证金
    private Boolean sfbcbzj = false;

    public Boolean getSfbcbzj() {
        return sfbcbzj;
    }

    public void setSfbcbzj(Boolean sfbcbzj) {
        this.sfbcbzj = sfbcbzj;
    }

    public Double getLlje() {
        return llje;
    }

    public void setLlje(Double llje) {
        this.llje = llje;
    }

    public Double getBzjbl() {
        return bzjbl;
    }

    public void setBzjbl(Double bzjbl) {
        this.bzjbl = bzjbl;
    }

    public Double getTx() {
        return tx;
    }

    public void setTx(Double tx) {
        this.tx = tx;
    }

    public Sjzdz getBzjlx() {
        return bzjlx;
    }

    public void setBzjlx(Sjzdz bzjlx) {
        this.bzjlx = bzjlx;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Date getKhfksj() {
        return khfksj;
    }

    public void setKhfksj(Date khfksj) {
        this.khfksj = khfksj;
    }

    public Integer getMxts() {
        return mxts;
    }

    public void setMxts(Integer mxts) {
        this.mxts = mxts;
    }

    public Double getTxl() {
        return txl;
    }

    public void setTxl(Double txl) {
        this.txl = txl;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Gsjg getNbgs() {
        return nbgs;
    }

    public void setNbgs(Gsjg nbgs) {
        this.nbgs = nbgs;
    }

    public Cght getCght() {
        return cght;
    }

    public void setCght(Cght cght) {
        this.cght = cght;
    }

    public BigDecimal getJe() {
        Double je1 = this.je == null ? 0 : this.je;
        BigDecimal yeDecimal = new BigDecimal(je1);
        return yeDecimal;
    }

    public void setJe(Double je) {
        this.je = je;
    }

    public Gsjg getKh() {
        return kh;
    }

    public void setKh(Gsjg kh) {
        this.kh = kh;
    }

    public Ejzh getEjzh() {
        return ejzh;
    }

    public void setEjzh(Ejzh ejzh) {
        this.ejzh = ejzh;
    }

    public Sfk getSk() {
        return sk;
    }

    public void setSk(Sfk sk) {
        this.sk = sk;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Sfk getFk() {
        return fk;
    }

    public void setFk(Sfk fk) {
        this.fk = fk;
    }

    public Double getYe() {
        return ye;
    }

    public void setYe(Double ye) {
        this.ye = ye;
    }

    public Long getJsts() {
        return jsts;
    }

    public void setJsts(Long jsts) {
        this.jsts = jsts;
    }
}
